-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update profilePage to include timezone #1717
Conversation
…e from personalDetailsList not separate API call
…ki-personaldetails-timezone
…ki-personaldetails-timezone
update priorityMode nvp to have correct const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good! I just have a few questions about the set/merge changes.
src/libs/actions/PersonalDetails.js
Outdated
@@ -125,7 +112,7 @@ function fetch() { | |||
}) | |||
.then((data) => { | |||
const allPersonalDetails = formatPersonalDetails(data.personalDetailsList); | |||
Onyx.merge(ONYXKEYS.PERSONAL_DETAILS, allPersonalDetails); | |||
Onyx.set(ONYXKEYS.PERSONAL_DETAILS, allPersonalDetails); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the change from merge()
to set()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there may be some personal details created that are not in the personalDetailsList
e.g. those added when loading reports or creating a chat with a brand new user. Is there a chance we are overwriting those here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we needed to merge
otherwise I believe we'd overwrite the timeZone
that was added to the personalDetails when we called fetchTimezone()
but now the details returned from personalDetailsList
and PersonalDetails_GetForEmails
both contain the timeZone so there's no need to merge instead of set.
Is there a chance we are overwriting those here?
I suppose if we're getting different persoanlDetaials from the report, then yes we would be overwriting it, so it may be best to stick with merge
over set
in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok cool. I think that's probably a safe bet here. It sort of makes sense to favor using merge()
over set()
unless there is a specific reason why we might want to blow away everything else we've got.
src/libs/actions/PersonalDetails.js
Outdated
@@ -135,7 +122,7 @@ function fetch() { | |||
myPersonalDetails.lastName = lodashGet(data.personalDetailsList, [currentUserEmail, 'lastName'], ''); | |||
|
|||
// Set my personal details so they can be easily accessed and subscribed to on their own key | |||
Onyx.merge(ONYXKEYS.MY_PERSONAL_DETAILS, myPersonalDetails); | |||
Onyx.set(ONYXKEYS.MY_PERSONAL_DETAILS, myPersonalDetails); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question about why set and not merge. But I can't think of any place we are modifying the myPersonalDetails
I think probably after the timezone changes in this PR we are just always overwriting the details with those from the server on page refresh. Which seems fine?
Can't seem to get the timezone stuff to work (even after updating Auth). I don't have a great idea about why that would be but here's what I tried:
logged out response of Any ideas? |
Ok after some back and forth @NikkiWines figured out that I must be testing with an account that did not have a personalDetails nvp set. We don't create one until the user modifies their avatar or name. Maybe we can create a follow up issue to do something about that since it's a little confusing that we aren't picking up the tz in E.cash unless the user has modified some unrelated field first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests good!
add priorityMode migration
updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! We have to add the migration to this list here and then we are all set
Oops, my bad forgot that part. |
updated! |
…ki-personaldetails-timezone
updated once more with conflicts resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great !
|
||
Onyx.multiSet({ | ||
priorityMode: null, | ||
[ONYXKEYS.NVP_PRIORITY_MODE]: oldPriorityMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda of unrelated but random thought here is that we should probably not reference ONYXKEYS
in migration files since the migration is "forever" even tho the constant in Onyx could possibly change. Nothing to do here just a weird thought I guess.
Details
PR does a couple of things:
fetchTimezone()
function and updates thepersonalDetails
onyx key so that each user's personalDetails also contains a timezone.priorityMode
onyx key to comply with how we want to save NVP onyx keys.Fixed Issues
Fixes https://github.com/Expensify/Expensify/issues/156248Tests
For testing you're going to need two accounts:
Account A
: This an account who on a policy with multiple different usersAccount B
: Someone who is on the same policy as account A.myPersonalDetails
onyx key to confirm it contains the correct timezone.Details
page.nvp_priorityMode
onyx key updates correctly.Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android
Video of Clicking on Chat Header
Screen.Recording.2021-03-19.at.10.20.12.AM.mov